// Copyright (C) 2012 Tanmay Sinha
// All rights reserved

package org.saakshar.content;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * A blog post.
 * 
 * @author tanmay
 * 
 */
public class Post {

	private final String id;
	private final String title;
	private final String content;
	private final List<Label> labels;

	public Post(String id, String title, String content) {
		this.id = id;
		this.content = content;
		this.title = title;
		this.labels = new ArrayList<Label>();
	}

	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	/**
	 * @return the title
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * @return the content
	 */
	public String getContent() {
		return content;
	}

	/**
	 * @return the labels
	 */
	public List<Label> getLabels() {
		return labels;
	}

	/**
	 * Add label to the post
	 * 
	 * @param label
	 *            the label string
	 */
	public void addLabel(String label) {
		addLabel(new Label(label));
	}

	/**
	 * Add a label to the post
	 * 
	 * @param label
	 *            the label to add
	 */
	public void addLabel(Label label) {
		labels.add(label);
	}

	@Override
	public String toString() {
		return title;
	}

}
